package com.cn.web.controller.Process;

import com.alibaba.fastjson2.JSONObject;
import com.cn.bean.vo.EM.partRegt.BarkPar;
import com.cn.mapper.dao.db5.Process.ProcessFlowDao;
import com.cn.mapper.dao.db5.Process.ProcessReportDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@Transactional
@RequestMapping("/Process")
public class ProcessController {
    private final ProcessReportDao processReportDao;
    private final ProcessFlowDao processFlowDao;


    @Autowired(required = false)
    public ProcessController(ProcessReportDao processReportDao, ProcessFlowDao processFlowDao) {
        this.processReportDao = processReportDao;
        this.processFlowDao = processFlowDao;
    }

    @RequestMapping("/getProcess")
    @ResponseBody
    public String getProcess(@RequestBody JSONObject jsonObject) {
        System.out.println("查询：" + jsonObject);
        String process = processReportDao.getProcess(String.valueOf(jsonObject));
        return process;

    }
    @RequestMapping("/getProcessReport")
    @ResponseBody
    public String getProcessReport(@RequestBody JSONObject jsonObject) {
        System.out.println("查询：" + jsonObject);
        String process = processReportDao.getProcessReport(String.valueOf(jsonObject));
        return process;

    }


    @RequestMapping("/iuProcess")
    @ResponseBody
    public BarkPar iuProcess(@RequestBody JSONObject jsonObject) {
        System.out.println("上传：" + jsonObject);
        BarkPar barkPar = processFlowDao.iuProcess(String.valueOf(jsonObject));
        return barkPar;
    }
}
